
function a1(e, p2, id, status) {
	$.cookie('id_', id);

	$.cookie('status_', status);

	p2 = query(p2);
	$.cookie('p2', p2);

	var c1 = 'kq.php?do=TemplatePlan.edit&id=' + id;
	var c2 = 'kq.php?do=TemplatePlan.view&id=' + id;
	var c3 = 'kq.php?do=TemplatePlan.copy&id=' + id;

	var a1 = [ '编辑信息', 'url', 'dialog_edit_', '600x320', '编辑信息' ];
	var a2 = [ '查看信息', 'url', 'dialog_view_', '600x320', '查看信息' ];
	var a3 = [ '复制信息', 'url', 'dialog_copy_', '600x320', '复制信息' ];

	var s = c1 + ", " + c2 + ", " + c3;

	return popup(e, [ a1, a2, a3], s);
}

function dialog_edit_(url, title, xy) {
	$.getJSON('kq.php?do=TemplatePlan.ajax_oper', function(json) {
		if (json.status == 1) {
			$('#dialog_edit').dialog('option', 'buttons', {
		
				"关闭" : function() {
					$(this).dialog("close");
				},
		
				"修改" : function() {
					if (!confirm("确认是否提交？")) {
						return false;
					}
		
					var form = $("#form_edit")[0];
		
					var body = {};
					body.id = form.id.value;
					
					body.t1 = form.date1.value + " " + form.time1.value;
					body.t2 = form.date2.value + " " + form.time2.value;
		
					body.content = form.content.value;
					body.status = form.status.value;
		
					$(this).dialog("close");
		
					var url = 'kq.php?do=TemplatePlan.editPost';
					var p2 = $.cookie('p2');
					if (p2 != null) {
						url += p2;
					}
		
					$.post(url, body, function(data) {
						$('#result').html(data);
					});
				}
			});
		
			dialog_edit(url, title, xy);
		} else {
			_error();
		}
	});
}

function dialog_copy_(url, title, xy) {
	$('#dialog_add').dialog(
			'option',
			'buttons',
			{

				"关闭" : function() {
					$(this).dialog("close");
				},

				"复制" : function() {
					if (!confirm("确认是否提交？")) {
						return false;
					}

					var form = $("#form_add")[0];

					var body = {};
					body.code = form.code.value;
					body.cpu = form.cpu.value;
					body.mb = form.mb.value;
					body.memory = form.memory.value;
					body.display = form.display.value;
					body.disk = form.disk.value;

					body.cdrom = form.cdrom.value;
					body.monitor = form.monitor.value;
					body.box = form.box.value;
					body.kb = form.kb.value;
					body.mouse = form.mouse.value;

					body.content = form.content.value;
					body.buydate = form.buydate.value;

					$(this).dialog("close");

					$.post('info.php?do=Computer.addPost', body,
							function(data) {
								$('#result').html(data);
							});
				}
			});

	dialog_add(url, title, xy);
}

function dialog_view_(url, title, xy) {
	$('#dialog_view').dialog('option', 'buttons', {

		"关闭" : function() {
			$(this).dialog("close");
		}
	});

	dialog_view(url, title, xy);
}
